﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlExtractor;


namespace SlTest
{
    public delegate PageResult GetOs(string s);
    public class TestBase
    {
        protected static string contentPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
        protected string ExtractorFile = @"Resource/Extractor.config";
        //protected PageResult GetOnlinePageResult(string parseUri)
        //{
           
        //    ParserContext context = new ParserContext(UriSource.GetOnlineSource(parseUri), parseUri);
        //    Extractor extr = new Extractor(extractorFile);
        //    return extr.GetResult(context);
           
        //}
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parseUri"></param>
        /// <param name="textUri"></param>
        /// <returns></returns>
        protected PageResult GetLoacalPageResult(string parseUri,string textUri)
        {
            textUri = contentPath + textUri;
            ParserContext context = new ParserContext(UriSource.GetSource(textUri), parseUri);
            Extractor extr = new Extractor(ExtractorFile);
            PageResult pr = new PageResult();
            extr.TryGetResult(context,out pr);
            return pr;

        }
    }
}
